<template>
    <div>
        <Breadcrumb>
            <Breadcrumb-item href="/">
                <Icon type="ios-home-outline"></Icon> 配置管理
            </Breadcrumb-item>
            <Breadcrumb-item href="">
                <Icon type="social-buffer-outline"></Icon> 网站配置
            </Breadcrumb-item>
            <Breadcrumb-item>
                <Icon type="pound"></Icon> 网站配置
            </Breadcrumb-item>
        </Breadcrumb>
        <Form ref="formValidate" :label-width="100" style="margin-top: 20px;">
            <FormItem label="注册方式">
                <RadioGroup v-model="sysInfo.regtype">
                    <Radio label="1" border>开启注册</Radio>
                    <Radio label="2" border>邀请注册</Radio>
                </RadioGroup>
            </FormItem>
            <div v-if="sysInfo.regtype == 2">
                <FormItem>
                    <Input v-model="sysInfo.description" placeholder="" style="width: 300px;"></Input>
                    <Button>复制链接</Button>
                </FormItem>
                <FormItem>
                    邀请链接有效期：48小时
                    <Button>重新生成</Button>
                </FormItem>
                <FormItem>
                    <img :src="baseImgeUrl + sysInfo.logo" style="width: 100px;height: 100px;">
                </FormItem>
            </div>
            <FormItem label="注册认证">
                <RadioGroup v-model="sysInfo.regauth">
                    <Radio label="0" border>关闭</Radio>
                    <Radio label="1" border>手机号</Radio>
                </RadioGroup>
            </FormItem>
            <FormItem label="开启IP定位">
                <RadioGroup v-model="sysInfo.ipregion">
                    <Radio label="0" border>关闭</Radio>
                    <Radio label="1" border>开启</Radio>
                </RadioGroup>
            </FormItem>
            <FormItem label="运行模式">
                <RadioGroup v-model="sysInfo.runMode">
                    <Radio label="1" border>企业模式</Radio>
                    <Radio label="2" border>社区模式</Radio>
                </RadioGroup>
            </FormItem>
            <FormItem label="绑定客服">
                <RadioGroup v-model="sysInfo.isBindAdmin">
                    <Radio label="1" border>开启</Radio>
                    <Radio label="0" border>关闭</Radio>
                </RadioGroup>
            </FormItem>
            <FormItem label="系统状态">
                <RadioGroup v-model="sysInfo.state">
                    <Radio label="1" border>开启</Radio>
                    <Radio label="0" border>关闭</Radio>
                </RadioGroup>
            </FormItem>
            <FormItem v-if="sysInfo.state == 0">
                <div>
                    关闭提示语：
                </div>
                <div>
                    <Input v-model="sysInfo.closeTips" placeholder="" style="width: 300px;"></Input>
                </div>
            </FormItem>
            <FormItem>
                <Button type="primary" @click="handleSubmit('formValidate')">保存</Button>
            </FormItem>
        </Form>
    </div>
</template>
<script>
export default {
    data() {
        return {
            sysInfo: {
                regtype: "1",
                regauth: "1",
                ipregion: "1",
                runMode: "1",
                isBindAdmin: "1",
                state: "1",
                closeTips: "",
            },
        }
    },
    methods: {
        getConfigInfo() {
            this.$axios('/admin/config/getConfigInfoByName', { name: 'sysInfo' }).then(res => {
                this.sysInfo = res;
            });
        },
        handleSubmit(name) {
            this.$axios('/admin/config/setSysInfo', this.sysInfo).then(res => {
                this.$Message.success('保存成功');
                this.getConfigInfo();
            })
        },
    },
    created() {
        this.getConfigInfo();
    },
}

</script>
